package com.zj.study.utils.validation.validator.digest;


import com.zj.study.utils.validation.annotation.ValidateSupport;
import com.zj.study.utils.validation.annotation.constraint.Digest;
import java.math.BigDecimal;
import org.springframework.lang.NonNull;

/**
 * @author 谭耀飞
 * @since 2021.03.0
 */
@ValidateSupport(BigDecimal.class)
public class DigestValidatorForBigDecimal extends AbstractDigestValidator<BigDecimal> {

  @Override
  boolean compare(@NonNull Digest digest, @NonNull BigDecimal value) {
    return value.scale() <= digest.value();
  }

}
